<?php echo $header;echo $sidebar ?>	
		<script type="text/javascript" src="<?php echo $this->config->base_url(); ?>assets/admin/admin_js/tinymce/tinymce.min.js"></script>	
		<script type="text/javascript">
tinymce.init({
        mode : "exact",
        elements : "email_body",
        plugins: [
                "advlist autolink autosave link image lists charmap print preview hr anchor pagebreak spellchecker",
                "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
                "table contextmenu directionality emoticons template textcolor paste fullpage textcolor"
        ],

        toolbar1: "newdocument fullpage | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | styleselect formatselect fontselect fontsizeselect",
        toolbar2: "cut copy paste | searchreplace | bullist numlist | outdent indent blockquote | undo redo | link unlink anchor image media code | inserttime preview | forecolor backcolor",
        toolbar3: "table | hr removeformat | subscript superscript | charmap emoticons | print fullscreen | ltr rtl | spellchecker | visualchars visualblocks nonbreaking template pagebreak restoredraft",

        menubar: false,
        toolbar_items_size: 'small',

        style_formats: [
                {title: 'Bold text', inline: 'b'},
                {title: 'Red text', inline: 'span', styles: {color: '#ff0000'}},
                {title: 'Red header', block: 'h1', styles: {color: '#ff0000'}},
                {title: 'Example 1', inline: 'span', classes: 'example1'},
                {title: 'Example 2', inline: 'span', classes: 'example2'},
                {title: 'Table styles'},
                {title: 'Table row 1', selector: 'tr', classes: 'tablerow1'}
        ],

        templates: [
                {title: 'Test template 1', content: 'Test 1'},
                {title: 'Test template 2', content: 'Test 2'}
        ]
});</script>
		
		
		<style>
			a.edit_icon {
		    background: url("<?php echo $this->config->base_url(); ?>assets/admin/admin_images/icons/edit.gif") no-repeat scroll left top transparent;
		    display: inline-block;
		    height: 16px;
		    width: 16px;
			}
			a.delete2_icon {
   	 			background: url("<?php echo $this->config->base_url(); ?>assets/admin/images/icon/delete.png") no-repeat scroll left top transparent;
    			display: inline-block;
    			height: 16px;
    			width: 16px;
			}
			ul.yiiPager {
			    border: 0 none;
			    display: inline;
			    font-size: 11px;
			    line-height: 100%;
			    margin: 0;
			    padding: 0;
			}
			
			ul.yiiPager a:link, ul.yiiPager a:visited {
			    border: 1px solid #9AAFE5;
			    color: #0E509E;
			    font-weight: bold;
			    padding: 1px 6px;
			    text-decoration: none;
			}
			.star {color: red;}
		</style>
		<div class="span10 content">

			<?php echo $hugemenu ?>

			<h1>Email Marketing</h1>

			<?php if($this->session->flashdata('message')) {?>
			<div class="alert alert-success">
				<?php echo $this->session->flashdata('message') ?>
			</div>
			<?php  }?>

			<div>
			
				<!-- Nav tabs -->
				<ul class="nav nav-tabs">
				  <li class="active"><a href="#">Templates</a></li>
				  <li><a href="settings">Settings</a></li>
				  <li><a href="mass_campaigns">Mass Campaigns</a></li>
				  <li><a href="sent_mail">Sent Mail</a></li>
				  <li><a href="hot_leads">Hot Leads</a></li>
				  <li><a href="alerts">Alerts</a></li>
				  <li><a href="subscription">Subscriptions</a></li>
				  <li><a href="mailing_list">Mailing List</a></li>
				  <li><a href="filters">Filters</a></li>
				  <li><a href="/index.php/emailgroup">Group</a></li>
				</ul>
				
				<!-- Tab panes -->
				<div class="tab-content">
				  
				  <?php

		//Show Flash Message

		if($msg = $this->session->flashdata('flash_message'))

		{

			echo $msg;

		}		

	  ?>
<?php

	  	//Content of a Email Setting

		if(isset($emailSettings) and $emailSettings->num_rows()>0)

		{

			$emailSetting = $emailSettings->row();



	  ?>
	  
	  <form id="valid_expense" action='<?=site_url('email_marketing/edit_emailmarketing_template/'.$emailSetting->id)?>' method='post' enctype="multipart/form-data">
  <table width="100%" cellpadding="5" >
    <tr>
      <th align="left" width="200">Start Date </th>
      <td><input type='text' id="start_date" name="start_date" value="<?php echo set_value('start_date',isset($emailSetting->start_date) ? $emailSetting->start_date:'');?>" class="text_box" />
      </td>
    </tr>
    <tr>
      <th align="left" width="200">End Date</th>
      <td><input type='text' id="end_date" name="end_date" value="<?php echo set_value('end_date',isset($emailSetting->end_date) ? $emailSetting->end_date:'');?>" class="text_box" />
      </td>
    </tr>
    <tr>
      <th align="left" width="200">Title <span class='star'>*</span></th>
      <td><input type='text' id="email_title" name="email_title" value="<?php echo $emailSetting->title; ?>" readonly class="text_box" style="width:500px;" /></td>
    </tr>
	
	<tr>
	<th align="left" width="200">Group <span class='star'>*</span></th>
		<td>
			<?php foreach($group_list->result() as $userinfo):?>
				<input type="checkbox" name="usergroup_name[]" value="<?php echo $userinfo->group_id;?>" class="ids" /> <?php echo $userinfo->group_name;?>
			<?php endforeach;?>
			
			<?php if(form_error('usergroup_name')) { ?><span class="errormsg_image"><?php echo form_error('usergroup_name');?></span><?php } ?>
		</td>
</tr>
	
    <tr>
      <th align="left" width="200">Email Marketing Subject <span class='star'>*</span></th>
      <td><input type="text" name="email_subject" value="<?php echo $emailSetting->mail_subject ; ?>" class="text_box" style="width:500px;"/>
        <?=form_error("email_subject", '<span class="error">', '</span>') ?>
      </td>
    </tr>
    <tr>
      <th align="left" width="200">Email Marketing Body <span class='star'>*</span></th>
      <td><textarea id="email_body" name="email_body" rows="6" cols="23" class="textarea_box_big"><?php echo $emailSetting->mail_body  ;?></textarea>
        <?=form_error("email_body", '<span class="error">', '</span>') ?>
        <?php $str = array(); $str = explode(' ',$emailSetting->mail_body) ?>
      </td>
      <td><?php $i=0;

		      foreach($str as $res)

	   			{

	   	 			$string = strchr($res,'!');

						

					if(isset($string) !='') { /* echo $string.'    '; */ };

	   			} ?>
      </td>
      <input type="hidden" name="id"  value="<?php echo $emailSetting->id; ?>"/>
    </tr>
    <tr>
      <th align="left" width="200">Email Status <span class='star'>*</span></th>
      <td><?php $options = array('1'=>"Active", '0'=>"Inactive");					
				echo form_dropdown('status',$options,set_value('status',isset($emailSetting->status)?$emailSetting->status:''),'class="styled"');?></td>
    </tr>
    <tr>
      <td colspan="2">
		  <div style="text-align:center;">
			<input type="submit" value="Save Changes" name="editEmailSetting" class="btn btn-primary">
			<!--a href="<?=site_url('EmailMarketing/emailmarketing_template')?>"  class="buttonGreen cancel">Cancel</a--> 
			<input type="button" value="Cancel" name="yt1" class="btn btn-primary"  onclick="redirtect_url('<?=site_url('email_marketing/template')?>')" />
			</div>
		</td>
    </tr>
  </table>
</form>
<?php

	  }

	 

	  ?>
	  
				
				</div>
								
				
			</div>
		</div><!--/content-->
<?php echo $footer ?>
<script>
$(document).ready( function () {
    $(".collapse").collapse()({
      show: false
      });
});
</script>